package com.zqu.controller;

import com.zqu.pojo.OrderDetail;
import com.zqu.service.Order1DetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("order1detail")
public class Order1DetailController {
    @Autowired
    private Order1DetailService order1DetailService;

    @RequestMapping("findorderdetail")
    @ResponseBody
    public OrderDetail selectById(){
        return order1DetailService.selectOrderDetailById(1);
    }

    @RequestMapping("selectlist")
    @ResponseBody
    public List<OrderDetail> selectlist(){
        return order1DetailService.selectList(new OrderDetail());
    }

    @RequestMapping("insertorderdetail")
    @ResponseBody
    public boolean insert(){
        return order1DetailService.insertOrderDetail(new OrderDetail());
    }

    @RequestMapping("updateorderdetail")
    @ResponseBody
    public boolean update(){
        return order1DetailService.updateOrderDetail(new OrderDetail());
    }

    @RequestMapping("deleteorderdetail")
    @ResponseBody
    public boolean delete(){
        return order1DetailService.deleteOrderDetail(1);
    }

    @RequestMapping("deleteorderdetailbyids")
    @ResponseBody
    public boolean deletebyids(){
        String[] ids = {"1","2"};
        return order1DetailService.deleteOrderDetailByIds(ids);
    }
}
